<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="__ROOT__/Public/Admin/shortcut icon" href="favicon.ico">
	<link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__ROOT__/Public/Admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
	<link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__ROOT__/Public/Admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<link href="__ROOT__/Public/Admin/css/official.css" rel="stylesheet">
	<link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">

</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1"><i class="fa fa-list-ol"></i> 列表</a>
                    </li>
                    <li class=""><a href="{:U('Datadict/savea')}"><i class="fa fa-plus"></i> 添加</a>
                    </li>
                </ul>  
                 <form class="well form-search form-inline" method="post" action="{:U('Datadict/Datadict')}">
                    <div class="form-group">
                        <input type="text" class="input form-control" name="keyword"  value="{:I('request.keyword/s','')}" placeholder="请输入类型名称">
                    </div>
                    <button type="submit" class="btn btn-search"> <i class="fa fa-search"></i> 搜索</button>
                </form>
                <table class="table table-bordered table-striped text-center" data-mobile-responsive="true">
                    <thead id="thead">
                        <tr>
                            <th>序号</th>
                            <th style="width:20%">类型名称</th>
							<th style="width:20%">字典名称</th>
							<th style="width:20%">取值</th>
							<th style="width:20%">备注</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
						
	                	<if condition="count($list) lt 1">
	                    	<tr> 
	                        	<td colspan="6" class="text-center">查无数据</td>
	                        </tr>
	                    <else />
	                    	<foreach name="list" item="vo">
								<tr>
									<td>{$vo.ID}</td>
									<td>{$vo.Pname}</td>
									<td>{$vo.Name}</td>
									<td>{$vo.ConfigValue}</td>
									<td>{$vo.Remark}</td>
									<td>
									<a class="edit-user label label-primary"  id="{$vo.ID}" href="<?=U('Admin/Datadict/savea',array('type'=>'edit','id'=>$vo['ID']))?>">编辑</a>
									<a class="delete-user label label-danger js-ajax-delete" id="{$vo.ID}" href="javascript:deletea({$vo.ID});">删除</a>
									</td>
								</tr>
	                    	</foreach>
	                   	</if>
                	</tbody>
          		</table>
          		{$page}
            </div>
        </div>
    </div>
	<script src="__ROOT__/Public/Admin/js/jquery.js"></script>  
	<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
 <script>
		//删除 item
		function deletea(id){
			$.post("{:U('Admin/Datadict/savea?type=delete')}",{id:id},function(result){
				if (result.status) {
	                swal({ 
						title: "操作成功！",  
						text: "数据字典删除！",  
						type: "success", 
						showCancelButton: false, 
						closeOnConfirm: false, 
						confirmButtonText: "返回" 
						}, function() { 
							document.location.reload();
					});
	            } else {
	                swal("操作失败！", result.info, "error");
	            }
			});
		}
 </script>
</body>
</html>